LOC = /home/hgtest513/lucca/qemucosim/gcc_riscv32/bin
CC = $(LOC)/riscv32-unknown-elf-gcc
AS = $(LOC)/riscv32-unknown-elf-as
LD = $(LOC)/riscv32-unknown-elf-ld
OBJCOPY = riscv32-unknown-elf-objcopy
QEMU = qemu-system-riscv32

CFLAGS = -march=rv32ima -mabi=ilp32 -nostdlib -lc
LDFLAGS = -T linker.ld

TARGET = demo.elf

all: $(TARGET)

$(TARGET): start.S main.cc
	$(CC) $(CFLAGS) -g -o $(TARGET) start.S main.cc my_print.cc $(LDFLAGS)

run: $(TARGET)
	$(QEMU) -machine virt -nographic -kernel $(TARGET)

clean:
	rm -f $(TARGET)
